// 引入 request 方法，假设 request 方法已经定义在某个工具文件中
import request from '/@/utils/request';
import { AddPluginInput, PagePluginInput, UpdatePluginInput,DeletePluginInput } from '../models';
// 定义 API 路径枚举
enum Api {
    SysPluginAdd = '/sysPlugin/add',
    SysPluginCompileAssembly = '/sysPlugin/compileAssembly',
    SysPluginDelete = '/sysPlugin/delete',
    SysPluginPage = '/sysPlugin/page',
    SysPluginRemoveAssembly = '/sysPlugin/removeAssembly/{assemblyName}',
    SysPluginUpdate = '/sysPlugin/update',
}

// 定义 API 方法
export const apiSysPluginAddPost = (body?: AddPluginInput) =>
    request({
        url: Api.SysPluginAdd,
        method: 'post',
        data: body,
    });

export const apiSysPluginCompileAssemblyPost = (body?: string, assemblyName?: string) =>
    request({
        url: `${Api.SysPluginCompileAssembly}?assemblyName=${assemblyName ?? ''}`,
        method: 'post',
        data: body,
    });

export const apiSysPluginDeletePost = (body?: DeletePluginInput) =>
    request({
        url: Api.SysPluginDelete,
        method: 'post',
        data: body,
    });

export const apiSysPluginPagePost = (body?: PagePluginInput) =>
    request({
        url: Api.SysPluginPage,
        method: 'post',
        data: body,
    });

export const apiSysPluginRemoveAssemblyAssemblyNamePost = (assemblyName: string) =>
    request({
        url: Api.SysPluginRemoveAssembly.replace('{assemblyName}', assemblyName),
        method: 'post',
    });

export const apiSysPluginUpdatePost = (body?: UpdatePluginInput) =>
    request({
        url: Api.SysPluginUpdate,
        method: 'post',
        data: body,
    });